<template>
  <div class="works">
    <Title title="作品集" :show="show"></Title>
    <div class="content">
      <div class="works-box">
        <ul>
          <li class="works-list" v-for="(work, index) in works" :key="index">
            <div class="works-img">
              <img :src="work.image" alt="">
            </div>
            <div class="title">
              <a href="javascript:;">{{ work.title }}</a>
            </div>
            <p class="des">{{ work.des }}</p>
            <div class="qrcode">
              <a v-if="work.url" target="_blank" :href="work.url">
                <img src="../../assets/images/w_link.svg" alt="">
              </a>
              <router-link v-else tag="a" :to="work.to">
                <img src="../../assets/images/w_link.svg" alt="">
              </router-link>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import Title from '../title/title'

import { mapState } from 'vuex'

export default {
  name: 'works',
  data () {
    return {
      show: false
    }
  },
  computed: {
    ...mapState(['works'])
  },
  components: {
    Title
  }
}
</script>

<style lang="less" scoped>
.works {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 50px 0 30px;
  display: flex;
  flex-direction: column;
  .content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    .works-box {
      // width: 300px;
      margin: 0 auto;
      ul {
        list-style-type: none;
        margin: 0;
        .works-list {
          width: 300px;
          padding: 10px;
          box-sizing: border-box;
          box-shadow: 0 6px 10px rgba(0, 0, 0, .2);
          background-color: #fff;
          border-radius: 6px;
          height: 375px;
          float: left;
          margin-right: 10px;
          &:last-child {
            margin-left: 0;
          }
          .works-img {
            img {
              display: block;
              width: 100%;
              height: 100px;
            }
          }
          .title {
            text-align: center;
            margin: 25px 0;
            a {
              font-size: 16px;
              font-weight: 700;
              color: #4985a0;
              text-decoration: none;
            }
          }
          .des {
            line-height: 18px;
            font-size: 14px;
          }
          .qrcode {
            width: 210px;
            height: 56px;
            border: 1px solid #999;
            margin: 0 auto;
            margin-top: 25px;
            a {
              display: block;
              height: 100%;
              display: flex;
              justify-content: center;
              align-items: center;
            }
            img {
              display: block;
              width: 30px;
              height: 30px;
            }
          }
        }
      }
    }
  }
}
</style>
